package Scheduler;



import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.Calendar;

import javax.swing.JFrame;
import javax.swing.JLabel;

class TimerThread extends Thread {
	
	Calendar cal;
	
	JLabel jlTodayp;
	JLabel jlClock;
	
	String sDate;
	String sTimer;
	
	public TimerThread(JLabel inJlTodayp, JLabel inJlClock){
		jlTodayp = inJlTodayp;
		jlClock = inJlClock;
	}
	
		
	public void run(){
		
		
		while(true){
			cal = Calendar.getInstance( );
			
			sDate = String.format("%04d-%02d-%02d",
                    cal.get(Calendar.YEAR),
                    (cal.get(Calendar.MONTH) + 1),
                    cal.get(Calendar.DAY_OF_MONTH));
			
			sTimer = String.format("%02d  %02d",
	                cal.get(Calendar.HOUR_OF_DAY),
	                cal.get(Calendar.MINUTE)
	            );
						
			jlTodayp.setText(sDate);
			jlClock.setText(sTimer);
			
			try{
				Thread.sleep(1000);
			}
			catch(InterruptedException e){return ;}
		}
	}
}

